/**
 * 
 */
package edu.pku.sei.modeler.figures;

import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.XYLayout;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.graphics.Color;

import edu.pku.notation.runtime.draw2d.DiamondFigure;
import edu.pku.notation.runtime.draw2d.TextFigure;
import edu.pku.sei.modeler.uml.ResourceFactory;

/**
 * @author YanYan
 *
 */
public class ChoicePseudostateFigure extends CommonFigure {

	public static final org.eclipse.swt.graphics.Color DECISIONNODE_COLOR = new Color(null,175,178,239);
	public IFigure root = null;
	private TextFigure choiceLable = null;
	private IFigure toolTip;
	
	public ChoicePseudostateFigure(){
		super();
		XYLayout xyL = new XYLayout();
		setLayoutManager(xyL);
		setOpaque(true);
		
		root = new DiamondFigure();
		root.setOpaque(true);
		root.setForegroundColor(ColorConstants.buttonDarkest);
		add(root);
		
		choiceLable = new TextFigure();
		choiceLable.setOpaque(false);
		choiceLable.setFont(ResourceFactory.getHeadFont());
		choiceLable.setForegroundColor(ColorConstants.black);
		choiceLable.setBackgroundColor(ColorConstants.white);
		add(choiceLable);
		
		toolTip = new Label("Choice");
		setToolTip(toolTip);
	}
	
	public void setBounds(Rectangle rect) {
		super.setBounds(rect);
		if (root != null)
			root.setSize(rect.width, rect.height);
		if (choiceLable != null) {
			choiceLable.setSize(rect.width, rect.height);
		}
	}
	protected void paintShadow(Graphics g) {
		// TODO: draw the figure's own shadow here
	}

	public TextFigure getChoiceLable() {
		return choiceLable;
	}
	
}
